package org.springblade.modules.repair.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.LinkedHashSet;
import java.util.Set;

/**
 * @Description 年审梯保养合规状态
 * @Author ysq
 * @Date 2023/4/27
 **/
@Getter
@AllArgsConstructor
public enum ComplianceStatusEnum {

	NORMAL(1, "正常"),

	VIOLATING(2, "明天即将违规"),

	VIOLATED(3, "已违规");

	final int id;

	final String name;

	/**
	 * 获取状态集合
	 * @return
	 */
	public static Set<Integer> getStatus() {
		Set<Integer> statusSet = new LinkedHashSet<>();
		for (ComplianceStatusEnum value : ComplianceStatusEnum.values()) {
			statusSet.add(value.getId());
		}
		return statusSet;
	}

	/**
	 * 根据id获取名称
	 * @param id
	 * @return
	 */
	public static String getNameById(Integer id) {
		for (ComplianceStatusEnum value : ComplianceStatusEnum.values()) {
			if (value.getId() == id) {
				return value.getName();
			}
		}
		return null;
	}

}
